
#ifndef __XEN_MMC_MNG_HPP__
#define __XEN_MMC_MNG_HPP__

#include "khan.hpp"

class xen_mmc_mng;
typedef boost::shared_ptr<xen_mmc_mng> 	xen_mmc_mng_ptr;

typedef struct job_t
{
	int _id;
	int _flag;
	std::string _data;
}job_t;

class xen_mmc_mng
:public boost::enable_shared_from_this<xen_mmc_mng>,
private boost::noncopyable       
{
public:
	static xen_mmc_mng_ptr instance();	

	~xen_mmc_mng();

	/* FIXME */
	void send_mmc(int id, const std::string& msg);
	void recv_mmc(int id, std::string& msg);
	void push_mmc(const std::string& msg);

private:
	typedef std::list<job_t> 	job_list_t;
	typedef job_list_t::iterator	job_iterator;

	xen_mmc_mng();

    static xen_mmc_mng_ptr _instance;
    static boost::mutex _singletone_lock;

	job_list_t _jobs;
	boost::mutex 	_list_lock;
	boost::mutex 	_send_lock;
	boost::condition _list_cond;
};


#endif	/* __XEN_MMC_MNG_HPP__ */
